import { GamePropData } from "../../../Data/GamePropData";
import AspectRatioTool from "../../../Tools/UiTool/AspectRatioTool";
import { utils } from "../../../../utils/CommonUtil";

export default class CompositeUi extends Laya.Script {
    /** 当前道具数据*/
    private curGamePropData: GamePropData;
    /** 道具ui*/
    private propImage: AspectRatioTool;
    private currentImage: fairygui.GLoader;

    onStart() {
        this.propImage = utils.CommonUtils.CustomAddComponent(this.owner, AspectRatioTool) as AspectRatioTool;
        this.InitUi();
    }
    public SetData(propData: GamePropData, currentImage: fairygui.GLoader) {
        this.curGamePropData = propData;
        this.currentImage = currentImage;
    }
    private InitUi() {
        this.propImage.SetSprite(this.currentImage, this.curGamePropData.atlasName, this.curGamePropData.spriteName);
    }
}